<include file="Admin:header" />
<style>
.mainnav_title {display:none;}
.table-list {margin:20px 10px;}
</style>

 

<div class="table-list"> 

<table border=0>
<form action="{:U($module_name.'/'.$action_name)}" method="post" name="myform"> 
  <input type="hidden" name="g" value="Admin"> 
  <input type="hidden" name="m" value="{$module_name}"> 
  <input type="hidden" name="a" value="{$action_name}">


	<tr>
		<td><span id="sp">总共有{$count.re}条记录,预计生成{$count.total}个文件</span></td>
	</tr>
	<tr>
		<td>模板选择
		<select name="b" id="b" onchange="swap(this.value);">
			<option value="">全部</option>
			<volist name="a" id="r">
			<option value="{$r.txt}">{$r.txt}</option>
			</volist>
		</select>
		<select name="t" id="t">
			<volist name="templates" id="r">
			<option value="{$r.filename}">{$r.filename}</option>
			</volist>
		</select>
		</td>
	</tr>
	<tr>	 
      <td rowspan="2"><input type="submit" style="margin:20px;" id="dosubmit" name="dosubmit" value="生成" class="button" ><span id="resinfo"></span></td>
    </tr>
	</form> 
</table>
<div id="spc" style="display:none;">{$count.content}
</div>
<span id="rs1"></span>


</div>
<script>
function swap(val){
	if(val==''){
		$('#sp').html('总共有{$count.re}条记录,预计生成{$count.total}个文件');
	}else{
		for(i=0;i<brand.length;i++){
			if(brand[i]==val){ $('#sp').html(brandtxt[i]); $('#spc').html(brandcontent[i]);}
		}
	}
}

var brand=new Array();
var brandtxt=new Array();
var brandcontent=new Array();
<volist name="a" id="r">
brand.push('{$r.txt}');
brandtxt.push('({$r.txt})总共有{$r.re}条记录,预计生成{$r.total}个文件');
brandcontent.push('{$r.content}');
</volist>

function sendrequest(){
	upstaut();
	$('#dosubmit').attr("disabled","disabled");
    $.post("{:U($module_name.'/'.$action_name)}",{
		dosubmit:1,
		b:$('#b').val(),
		t:$('#t').val()
	},
	function(data){
		clearInterval(vid);
		$('#resinfo').html('生成完毕!用时:'+hh+':'+ii+':'+ss);
		$('#resinfo').css('color','red');
		$('#dosubmit').removeAttr("disabled");
	});
}

function upstaut(){
var h=0;
var i=0;
var s=0;
var str='正在生成文件,用时:00:00:00';
$('#resinfo').css('color','#000000');
vid=setInterval(function(){
s+=1;
if(s>59){
	s=0;
	i+=1;
	if(i>59){i=0;h+=1;}
}
if(h<10){hh='0'+h;}else{hh=h;}
if(i<10){ii='0'+i;}else{ii=i;}
if(s<10){ss='0'+s;}else{ss=s;}
str='正在生成文件,用时:'+hh+':'+ii+':'+ss;
$('#resinfo').html(str);
if(s%10==0){
	$.get("index.php?g=Admin&m=Createhtml&a=stateflag",
	function(data){
		clearInterval(vid);
		$('#resinfo').html('生成完毕!用时:'+hh+':'+ii+':'+ss);
		$('#resinfo').css('color','red');
		$('#dosubmit').removeAttr("disabled");
	}
	);
}

},1000);
}
</script>